﻿/******************************************************************************              
 * Author: 671643387@qq.com                                                                                                                                            
 * @MR.Luo                                                                                      
 *****************************************************************************/

#pragma once

#include <iostream>
#include <dev/Dev.hpp>

extern volatile unsigned int gconns;
extern volatile unsigned long long gpackets;
extern volatile unsigned long long gbytestransfered;

inline void inc_conn(void)
{
    dev::base::atom_inc32((uint32_t*)&gconns);
}

inline void dec_conn(void)
{
    dev::base::atom_dec32((uint32_t*)&gconns);
}

inline void inc_packets(void)
{
    dev::base::atom_inc64((uint64_t*)&gpackets);
}

inline void add_transfered_bytes(unsigned long long value)
{
    dev::base::atom_add64((uint64_t*)&gbytestransfered, value);
}